const Sequelize = require('sequelize');
const models = require('../models')

const Op = Sequelize.Op
const QRCode = models.QRCode

async function searchBetween(start, end) {
    return await QRCode.findAll({
        where: {
            expireDate: {
                // [Op.between]: [new Date(start), new Date(end)]
                [Op.lte]: new Date(end)
                // [Op.gte]: new Date(start)
            }
        }
    })
}

searchBetween('2020-11-15', '2020-11-26').then(res => console.log(res.length))